package com.xian.tszs.meal.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.xian.tszs.meal.entity.TsGoods;
import com.xian.tszs.meal.mapper.TsGoodsMapper;
import com.xian.tszs.meal.repository.TsGoodsRepository;
import com.xian.tszs.meal.service.TsGoodsService;

@Service
public class TsGoodsServiceImpl implements TsGoodsService {

	
	@Autowired
	private TsGoodsMapper tsGoodsMapper;
	
	@Autowired
	private TsGoodsRepository tsGoodsRep; 
	
	
	@Override
	public List<TsGoods> findGoodsPage(TsGoods tsGoods) {
		return tsGoodsMapper.findGoodsAll(tsGoods);
	}
	
	@Override
	public void saveGood(TsGoods tsGoods) {
		
		tsGoodsMapper.saveGood(tsGoods);
	}

	@Override
	public void deleteGoodsById(String id) {
	
		tsGoodsMapper.deleteById(id);
	}

	@Override
	public TsGoods findGoodsById(String id) {
		
		return tsGoodsRep.findById(id).get();
	}

	@Override
	public void updateGoods(TsGoods tsGoods) {
		
		tsGoodsMapper.updateGoods(tsGoods);
	}

	@Override
	public void updateGoodsState(String value ,String id) {
		// TODO Auto-generated method stub
		tsGoodsMapper.updateGoodsState(value,id);
	}

	@Override
	public void deleteMany(String[] ids) {
		// TODO Auto-generated method stub
		tsGoodsMapper.deleteMany(ids);
	}

}
